package wechat.rcv.cosuming;

import org.eclipse.xtend.lib.Property
import org.w3c.dom.Document
import wechat.rcv.util.XmlRequestParser
import lombok.experimental.Accessors

class RequestObj {
//	<xml>
//<ToUserName><![CDATA[toUser]]></ToUserName>
//<FromUserName><![CDATA[FromUser]]></FromUserName>
//<CreateTime>123456789</CreateTime>
//<MsgType><![CDATA[event]]></MsgType>
//<Event><![CDATA[SCAN]]></Event>
//<EventKey><![CDATA[SCENE_VALUE]]></EventKey>
//<Ticket><![CDATA[TICKET]]></Ticket>
//</xml>
	@Property String ToUserName
	@Property String FromUserName
	@Property String CreateTime
	@Property String MsgType
	@Property String Event
	@Property String EventKey
	@Property String MsgID
	@Property String Status
	
	Document doc;
	new (){}
	new(String xml){
		doc = XmlRequestParser::getDocument(xml)
		if (doc!=null){
		toUserName = XmlRequestParser::getElementByTagFromDoc(doc, 'ToUserName')
		fromUserName = XmlRequestParser::getElementByTagFromDoc(doc, 'FromUserName')
		createTime = XmlRequestParser::getElementByTagFromDoc(doc, 'CreateTime')
		msgType = XmlRequestParser::getElementByTagFromDoc(doc, 'MsgType')
		event = XmlRequestParser::getElementByTagFromDoc(doc, 'Event')
		eventKey = XmlRequestParser::getElementByTagFromDoc(doc, 'EventKey')
		msgID = XmlRequestParser::getElementByTagFromDoc(doc, 'MsgID')
		status = XmlRequestParser::getElementByTagFromDoc(doc, 'Status')
		}
	}
}
